//
//  NavigationBarStyleManager.swift
//  BookReading
//
//  Created by iOS-Czz on 2023/7/18.
//

import Foundation
import UIKit

class NavigationBarStyleManager {
    static func configureNavigationBar(for viewController: UIViewController, with color: UIColor, title: String, titleColor: UIColor, leftButton: UIBarButtonItem?, rightButton: UIBarButtonItem?) {
        if let navigationController = viewController.navigationController {
            navigationController.navigationBar.barTintColor = color
            
            // 标题设置
            let titleLabel = UILabel()
            titleLabel.text = title
            titleLabel.textColor = titleColor
            viewController.navigationItem.titleView = titleLabel
            
            // 左按钮设置
            viewController.navigationItem.leftBarButtonItem = leftButton
            
            // 右按钮设置
            viewController.navigationItem.rightBarButtonItem = rightButton
        }
    }
}
